I'm studying prototype and doing some testing, and I've decided to assign a method to the String object like this:
String.prototype.sel = function sel() {
var elem = doc.querySelectorAll(this);
if (elem.length == 1)
return elem[0];
return elem;
}
And when getting a console.log(String.prototype) and getting the method I created, I noticed that in [[Scopes]] I get 1: Global {window: Window..., what does [[Scopes]] mean?
Complete test:
String.prototype.sel = function sel() {
var elem = document.querySelectorAll(this);
if (elem.length == 1)
return elem[0];
return elem;
}
'[btnSend]'.sel().onclick = () => {
alert('ok')
}
console.log(String.prototype);
<button btnSend>Send</button>